package com.example.home_stretch;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class Android_js extends AppCompatActivity {

    @BindView(R.id.webview)
    WebView webview;
    @BindView(R.id.tv_wz)
    TextView tvWz;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_android_js);
        ButterKnife.bind(this);
        initview();
    }

    @SuppressLint({"SetJavaScriptEnabled"})
    private void initview() {
        //支持javaScrip的显示
        WebSettings webSettings = webview.getSettings();
        //弹窗权限，支持权限
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        webSettings.setJavaScriptEnabled(true);
        webview.loadUrl("file:///android_asset/aaa.html");
    }

    @OnClick(R.id.tv_wz)
    public void onViewClicked() {
        startActivity(new Intent(Android_js.this,Javascript_android.class));
    }
}
